import 'package:flutter/material.dart';
import 'package:hi_flutter/im/contacts/contacts_sider_list.dart';
import 'package:hi_flutter/im/contacts/contacts_vo.dart';
import 'package:hi_flutter/im/contacts/contacts_header.dart';
import 'package:hi_flutter/im/contacts/contacts_item.dart';

class Contacts extends StatefulWidget {
  const Contacts({super.key});

  @override
  State<StatefulWidget> createState() {
    return ContactsState();
  }
}

class ContactsState extends State<Contacts> {
  @override
  Widget build(BuildContext context) {
    return Center(
        child: Scaffold(
      body: ContactsSiderList(
        items: contactsData,
        headerBuilder: (BuildContext context, int index) {
          return const ContactsHeader();
        },
        itemBuilder: (BuildContext context, int index) {
          return Container(
            color: Colors.white,
            alignment: Alignment.centerLeft,
            child: ContactsItem(item: contactsData[index]),
          );
        },
        sectionBuilder: (BuildContext context, int index) {
          return Container(
            height: 32.0,
            padding: const EdgeInsets.only(left: 14.0),
            alignment: Alignment.centerLeft,
            child: Text(
              contactsData[index].sectionKey!,
              style: const TextStyle(fontSize: 14.0, color: Color(0xff909090)),
            ),
          );
        },
      ),
    ));
  }
}
